extends Control

signal warning_finished

@onready var animation_player: AnimationPlayer = $AnimationPlayer
@onready var panel: Panel = $Panel
@onready var enemy_name_label: Label = $Panel/EnemyNameLabel
@onready var show_timer: Timer = $ShowTimer

var enemy_name: String = "空军钓鱼佬"

func _ready() -> void:
	hide()
	panel.hide()

func display() -> void:
	show()
	animation_player.play("warning_enter")

func show_panel() -> void:
	animation_player.play("warning")
	enemy_name_label.text = enemy_name
	panel.show()
	show_timer.start()

func finish_warning() -> void:
	panel.hide()
	animation_player.play("warning_exit")

func hide_warning_screen() -> void:
	hide()
	warning_finished.emit()

func _on_show_timer_timeout() -> void:
	finish_warning()
